By default, grep searches for all files, including files in hidden folders.
For example, use the following command to search for the mediabutton string. The search result contains files in the hidden folder.
Grep-Nr mediabutton *
If the code is
Search for a paragraph with a keyword (grep) from the output -- grep-p usageUpdate @ 20170424On Linux we can use below command:Awk 'in in {RS = ORS = "\ n"; FS = OFS = "\ n"}/V403PAA/'pa4.jil==========================================================
Regular expressions are not the same as wildcard characters, and they represent different meanings.
The grep command's options are used to supplement the search process. The grep command has a flexible pattern, can be a string, a variable, or a
The first thing to remember is that regular expressions and wildcards have different meanings!A regular expression is only a representation. As long as the tool supports this representation, the tool can process the string of a regular expression.
From: http://hi.baidu.com/nearlove/blog/item/11db98b6b5b8aff831add1e5.html
The first thing to remember is that regular expressions and wildcards have different meanings!A regular expression is only a representation. As long as the tool supports
A regular expression is only a representation. As long as the tool supports this representation, the tool can process the string of a regular expression. Vim, grep, awk, and sed both support regular expressions, and they seem powerful because they
Search for and display file names from a file
When you search from more than one file, it displays the file name by default:
The code is as follows:
grep "word" file name
grep root/etc/*
Sample output:
The code is as follows:
/etc/bash.bashrc:
Number of statistics files (excluding hidden files/folders)Ls-l | grep "^-" | Wc-l count the number of files in the current directory LS-LR | grep "^-" | Wc-l statistics the number of files in the current directory,
# ls First look at some files, this is the Linux unique Android driver. (Table of Contents: Kernel/drivers/staging/android/)
# Find.-type f!-name "*.O" excludes files that end with ". O", but hides the file (with "." The beginning of the
The default grep searches all files, including files under Hidden folders. The --exclude-dir= parameter of grep is to exclude a directory, which does not contain the directory after the equals sign, so we can use this parameter to remove the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.